#include "AuxiliaryFile.h"

using std::ifstream;
using std::ios;

/********************************************************************************************/
AuxiliaryFile::AuxiliaryFile(string name):File(name)
{
	_eof = false;
}
/********************************************************************************************/
AuxiliaryFile::~AuxiliaryFile()
{
	
}
/********************************************************************************************/
void AuxiliaryFile::addRegister( tRegAuxiliary& _register )
{
	fdFile.write( (char*)&_register, sizeof(_register) );
}
/********************************************************************************************/
void AuxiliaryFile::readRegister( tRegAuxiliary& _register )
{
	fdFile.read( (char*)&_register, sizeof(_register) );

	if ( (fdFile.rdstate() & ifstream::eofbit ) != 0 )
		_eof = true;

}
/********************************************************************************************/
unsigned int AuxiliaryFile::sizeData(void)
{
	return sizeof(tRegAuxiliary);
}
/********************************************************************************************/
using std::cout;
using std::endl;
void AuxiliaryFile::back(void)
{
	int posInit;
	posInit = fdFile.tellg();
	
	if (posInit == 0)
		return;
	
	fdFile.seekg (posInit-sizeof(tRegAuxiliary), ios::beg);
}

